package com.example.shixi.service;

import com.example.shixi.domain.Employee;
import com.example.shixi.domain.EmployeeExample;
import com.example.shixi.mapper.EmployeeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class IEmployeeService {
//    @Resource
//    private Employee employee;
    @Resource
    private EmployeeMapper employeeMapper;

    public List<Employee> selectAll(){
        EmployeeExample employeeExample = new EmployeeExample();
        List<Employee> employees = employeeMapper.selectByExample(employeeExample);
        return employees;
    }
    public void delete(Long id){
        System.out.print(id);
        employeeMapper.deleteByPrimaryKey(id);
    }
    public void add(Employee emp){
        employeeMapper.insert(emp);
    }
    public void update(Employee emp){
        employeeMapper.updateByPrimaryKey(emp);
    }
}
